[#-- 需要公司审核通过才能访问的菜单code，点击会弹出提示框 --]
[#assign tipCodes = ["messageOptions", "enquiryOptions", "messageOptions2", "enquiryOptions2"]/]
<link href="/res/css/common/backcommon.css" rel="stylesheet"
	type="text/css" />
<div class="back-side">
	[@businessmenu_list showType=1 menucode=menucode]
	<ul>
		[#if parentmenu??] [#list parentmenu as par]
		<li>
			<h3 class="firstMen">
				<span class="${par.code!}"></span>${par.name!}
			</h3> [#list par.children as child]
			<p
				class="secondMen [#if child.code?? && menucode?? && child.code == menucode ] active[/#if]">
				<a  [#if ((currentcompany?? && currentcompany.auditState!=3) || (currentRole?? && currentRole.roleType==3)) && homePage?? ]
					[#-- 首页菜单 --]
					[#if (child.code == 'companyInfo') && (currentcompany?? && currentcompany.auditState!=4)]
					href="${child.uri!}"
					[#else]
							href="javascript:void(0);" onclick="friendlyTip(this)"
					[/#if]
				[#else]
					[#-- 非首页菜单(账户设置，消息) --]
					[#if ((currentcompany?? && currentcompany.auditState!=3) || (currentRole?? && currentRole.roleType==3)) && tipCodes?seq_contains(child.code)]
							href="javascript:void(0);" onclick="friendlyTip(this)"
					[#else]
						 href="${child.uri!}"
					[/#if]
				[/#if]>${child.name!}</a>
			</p> [/#list]
		</li> [/#list] [/#if]
	</ul>
	[/@businessmenu_list]
</div>
<script type="text/javascript" src="/res/js/common/common.js"></script>
<script type="text/javascript">
window.onload = function(){
	$(".firstMen").bind("click", function(){
		  if($(this).length){
			  if($(this).nextAll(".secondMen").is(':hidden')){
				  $(this).nextAll(".secondMen").show();
			  }else{
				  $(this).nextAll(".secondMen").hide();
			  }
	        }
	});
   
	$(".secondMen").each(function() {
	    if($(this).hasClass("active")){
	    	$(this).parents("li").css("background-color","#fafafa");
	    	[#if currentRole?? && currentRole.roleType==1]
	    	$(this).parents("li").css("border-color","#00ceff");
	    	[/#if]//采购商
	    	 [#if currentRole?? && currentRole.roleType==2]
	    	$(this).parents("li").css("border-color","rgb(255, 192, 1)");
	    	[/#if]//采购商
	    }
	});
};
/*权限弹框**/
function friendlyTip(o){ 
	if($(o).text().trim()=="企业资料"){
		window.location.href="/company/info";
		return;
	}
	var powerKuang='<div class="coverDiv"></div>'
	+'<div class="noPowerOuter">'
	+'<img style="position: absolute;top: 15px;right: 20px;cursor: pointer;" src="/res/images/common/close.jpg" alt="" onclick="closePower(this)"/>'
	+'<div class="contTip">'
	+'<img style="height: 40px;vertical-align: middle;" src="/res/images/oparaStatus/emailWarn.jpg" alt="" />'
	+'<div style="display: inline-block;vertical-align: middle;" >'
	+'<h5>提醒</h5>'
	+'<h6>[#if currentcompany?? && currentcompany.auditState!=3]您的企业信息正处于[#if currentcompany.auditState==0]待审核[#elseif  currentcompany.auditState==1]待重新审核[#elseif currentcompany.auditState==2]退回修改[#elseif currentcompany.auditState==4]禁用[/#if]状态，无法进行操作。[#elseif currentRole?? && currentRole.roleType==3 ]您还未绑定任何企业信息，无法进行操作。[/#if]</h6>'
	+'</div>'
	+'</div>'
	+'<div style="text-align: center;margin-top: 30px;">'
    [#if !currentcompany??]
	+'<button class="iKnow" style="margin-right: 10px; margin-left: 10px;" type="button" onclick="closePower(this,1)">去绑定</button>'
    [/#if]
    [#if currentcompany??]
	+'<button class="iKnow" style="margin-right: 10px; margin-left: 10px;" type="button" onclick="closePower(this,2)">去查看</button>'
    [/#if]
	+'</div>'
	+'</div>';
	$("body").append(powerKuang);
	var dh=$(window).height();
	var dw=$(window).width();
	$(".coverDiv").height(dh);
	$(".coverDiv").width(dw); 
	$(".noPowerOuter").css("top",dh/2-100); 
	$(".noPowerOuter").css("left",dw/2-200); 
	$(".coverDiv").show();
	$(".noPowerOuter").show();
}
function closePower(o,n){  
	$("body").find(".coverDiv").remove();
	$("body").find(".noPowerOuter").remove();
	if($(o).text()!=""){
		if(n==1){
		window.location.href="/user/companySearch";
		}
		if(n==2){
			window.location.href="/company/info";
		}
	} 
} 
</script>